
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>花城后台管理</title>

    <!-- 公共样式 开始 -->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/manager/css/base.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/manager/css/iconfont.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/manager/framework/jquery-1.11.3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/manager/layui/css/layui.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/manager/layui/layui.js"></script>
    <!-- 滚动条插件 -->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/manager/css/jquery.mCustomScrollbar.css">
    <script src="${pageContext.request.contextPath}/manager/framework/jquery-ui-1.10.4.min.js"></script>
    <script src="${pageContext.request.contextPath}/manager/framework/jquery.mousewheel.min.js"></script>
    <script src="${pageContext.request.contextPath}/manager/framework/jquery.mCustomScrollbar.min.js"></script>
    <script src="${pageContext.request.contextPath}/manager/framework/cframe.js"></script><!-- 仅供所有子页面使用 -->
    <!-- 公共样式 结束 -->

</head>

<body>

<div class="cBody">
<%--    ${sessionScope.admin.password}--%>
    <form id="addForm" class="layui-form" action="${pageContext.request.contextPath}/adminServlet">
        <input  type="hidden" name="action" value="updateAdmin">
        <div class="layui-form-item">
            <label class="layui-form-label">原始密码</label>
            <div class="layui-input-inline shortInput">
                <input id="old_password" type="password" name="oldpassword" required lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">新密码</label>
            <div class="layui-input-inline shortInput">
                <input id="password" type="password" name="password" required lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">确认新密码</label>
            <div class="layui-input-inline shortInput">
                <input id="password2" type="password" name="password2" required lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="submitBut">确认修改</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
    <script>
        layui.use('form', function() {
            var form = layui.form;
            //监听提交
            form.on('submit(submitBut)', function(data) {
                var password="${sessionScope.admin.password}";
                console.log(password)
                console.log($('#old_password').val())
                layer.msg(JSON.stringify(data.field));
                if ($('#old_password').val()===password) {
                    if ($('#password').val()===$('#password2').val()) {
                        alert("修改密码成功！")
                    } else {
                        alert("两次密码输入不一致！")
                    }
                }else {
                    alert("密码不正确！")
                }
                return true;
            });
        });
    </script>

</div>
</body>
</html>
